<template>
  <div>
    上传文件目录：
    <vxe-table
        border="outer"
        resizable
        ref="xTree"
        row-id="id"
        :show-header="false"
        :tree-config="{rowField: 'dirPath', expandAll: true}"
        :data="uploadsDir">
      <vxe-column field="name" title="Name" tree-node>
        <template #default="{row}">
          {{row.name}} {{row.dirPath}}
        </template>
      </vxe-column>
    </vxe-table>
  </div>
</template>

<script setup>
import {httpRequest} from "../../untils/httpRequest";
import {onMounted, ref} from "vue";
import {ElMessage} from "element-plus";

let uploadsDir = ref([])
const getFiles = () => {
  return new Promise((resolve, reject) => {
    let params = {}
    httpRequest("post", "/getFiles", null, params, "proxy").then(res => {
      if (res?.data?.code === 200) {
        uploadsDir.value = res?.data?.data
        resolve()
      } else {
        return ElMessage.error(res?.data?.msg)
        reject()
      }
    })
  })
}
onMounted(() => {
  getFiles()
})

</script>

<style scoped>

</style>